package com.ddwl.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Fu Zhaohui
 * @version 1.0.0
 * @date 2019/6/27 10:55
 */
public interface ShopEnum {

    @AllArgsConstructor
    @Getter
    enum TypeEnum {
        JOINED("平台入驻", 0),
        SELF("自营", 1),
        MCH_JOIN("加盟", 2),
        DRIVER("司机", 3),
        ;
        private String name;
        private Integer code;
    }

    @AllArgsConstructor
    @Getter
    enum WxTypeEnum {
        WECHAT("公众号", (byte) 1),
        MINIAPP("小程序", (byte) 2),
        ;
        private String name;
        private Byte code;
    }

    @AllArgsConstructor
    @Getter
    enum MerchantAuditStatus {
        UN_AUDIT("待审核", (byte) 0),
        PASS("审核通过", (byte) 1),
        REJECT("审核拒绝", (byte) 2),
        ;
        private String name;
        private Byte code;
    }

    @AllArgsConstructor
    @Getter
    enum ShopStatus {
        CLOSED("暂停营业", (byte) 0),
        NORMAL("正常营业", (byte) 1),
        ;
        private String name;
        private Byte code;
    }

    /**
     * 售后状态
     */
    @AllArgsConstructor
    @Getter
    enum ApproveStatus {
        APPLY(0, "提交申请"),
        PASS( 1, "审批通过"),
        REJECT( 2, "已拒绝"),
        CANCEL(3, "取消审批后"),
        STATE1(4, "未审批状态1"),
        STATE2(5, "未审批状态2"),
        STATE3(6, "未审批状态3"),
        ;

        private Integer code;
        private String name;

        // 根据code获取名称
        public static String getValueByCode(Integer code) {
            for (ApproveStatus t : ApproveStatus.values()) {
                if (t.getCode().equals(code)){
                    return t.getName();
                }
            }
            return null;
        }
    }

    /**
     * 付款状态 0待付款 20付款成功 30付款失败
     */
    @AllArgsConstructor
    @Getter
    enum PayStatus {

        PEND_PAY(0, "待付款"),
        PAY_SUCCESS(20, "付款成功"),
        PAY_FAIL(30, "付款失败"),

        ;
        private Integer code;
        private String name;
    }

    /**
     * 帮扶基金领取状态 0未领取 1已领取
     */
    @AllArgsConstructor
    @Getter
    enum AssistFundStatus {

        UN_RECEIVE(0, "未领取"),
        RECEIVED(1, "已领取"),

        ;
        private Integer code;
        private String name;
    }

    /**
     * 是否店主店铺 0否 1是
     */
    @AllArgsConstructor
    @Getter
    enum OwnShopEnum {
        NO(0, "否"),
        YES(1, "是"),

        ;
        private Integer code;
        private String name;
    }

}
